﻿using Archiecture.API.Application.Commands.DeepCommand;
using Architercture.Domain.Service.IService;
using MediatR;
using Swork03_28.Domain.TraceableInfos;

namespace Archiecture.API.Application.CommandHandlers.DeepCommandHandler
{
    public class CreateDeepProcessCommandHandler : IRequestHandler<CreateDeepProcessCommand, int>
    {
        private readonly IDeepProcessService _deepSerivce;

        public CreateDeepProcessCommandHandler(IDeepProcessService deepSerivce)
        {
            _deepSerivce = deepSerivce;
        }

        public async Task<int> Handle(CreateDeepProcessCommand request, CancellationToken cancellationToken)
        {
            return await _deepSerivce.CreateDeepProcess(new DeepProcess
            {
                BatchCode = request.batchCode,
                GroupName = request.groupName,
                Principal = request.principal
                  
            });
        }
    }
}
